package com.example.microservice04.controller;

import com.example.microservice04.feign.MicroService01FeignTest;
import com.example.microservice04.feign.MicroService02FeignTest;
import com.example.microservice04.feign.MicroService03FeignTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author czj
 * @date 2019/6/24 2:50 PM
 */
@RestController
@RequestMapping("service04")
public class FeignTestController {

    @Autowired
    private MicroService01FeignTest microService01FeignTest;
    @Autowired
    private MicroService02FeignTest microService02FeignTest;
    @Autowired
    private MicroService03FeignTest microService03FeignTest;


    @GetMapping("feignTest")
    public String feignTest(String str) {
        System.out.println("===========6============");
        String result01 = microService01FeignTest.microService01FeignTest(str);
        String result02 = microService02FeignTest.microService02FeignTest(str);
        String result03 = microService03FeignTest.microService03FeignTest(str);
        System.out.println("===========9============");
        return "我是service04，调用 service01 success -> " + result01 + "\n" +
               "我是service04，调用 service02 success -> " + result02 + "\n" +
               "我是service04，调用 service03 success -> " + result03;
    }

    @GetMapping("feignTest01")
    public String feignTest01(String str) {
        String result01 = microService01FeignTest.microService01FeignTest(str);
        return "我是service04，调用 service01 success -> " + result01;
    }

}
